﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAOAuction;
using DTOAuction;

namespace BUSAuction
{
	public class BUSLichDangKy : DAOLichDangKy
	{
		public static LICHDANGKY layLichDangKyHienTai()
		{
			try
			{
				DateTime now = DateTime.Now;
				int namHoc, hocKy;
				
				if (now.Month >= 1 && now.Month <= 6)
				{
					hocKy = 2;
					namHoc = now.Year - 1;
				}
				else
				{
					hocKy = 1;
					namHoc = now.Year;
				}

				LICHDANGKY ldk = DAOLichDangKy.layLichDangKy(namHoc, hocKy);
				ldk.HOCPHANMOs = null;
				return ldk;
			}
			catch
			{
				throw;
			}
		}

		public static bool kiemTraThoiHanDangKyHocPhan(DateTime thoiDiem)
		{
			try
			{
				LICHDANGKY ldk = layLichDangKyHienTai();
				if (thoiDiem < ldk.TUNGAY || thoiDiem > ldk.DENNGAY)
					return false;
				return true;
			}
			catch
			{
				throw;
			}
		}
	}
}
